import {defineStore} from "pinia"

export const useTasksStore = defineStore('tasks',{
    state:()=>({
        tasks:[
            {id:1,task:"联系供应商供货",publisher:"Auraro~",publishTime:"2022-03-01 21:17",status:"待完成",taskDetail:"联系书籍供应商在12月13号之前供应1000本《哈姆雷特》书籍"},
            {id:2,task:"清点文学类库存",publisher:"Zaner",publishTime:"2022-07-14 18:03",status:"已完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:3,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:4,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:1,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:7,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:12,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:10,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:1,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:15,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:1,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"jisjdiajdiaji"},
            {id:1,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
            {id:1,task:"更新库存信息",publisher:"Jerry",publishTime:"2024-07-08 4:18",status:"待完成",taskDetail:"清点文学类的所有书籍的库存数量，并提交报告给Arora~"},
        ]
    }),

    actions:{
        async setStatus(id:Number){
            for(let i=0;i<this.tasks.length;i++){
                if(this.tasks[i].id == id){
                    this.tasks[i].status = "已完成"
                    return
                }
            }
        },

    }
})
